$(document).ready(function() {
		var searchUrl = window.location.href;
		if(searchUrl.indexOf("searchText=") != -1) {
			var firstStr="searchText=";
			var lastStr="#page";
			var searchText;
			var firstIndex = searchUrl.indexOf("searchText=");
			if(searchUrl.indexOf("#page")!= -1){
				var lastIndex = searchUrl.indexOf("#page");
				searchText=decodeURI(searchUrl.substring(firstIndex+firstStr.length,lastIndex))
			}else{
				searchText = decodeURI(searchUrl.substring(firstIndex+firstStr.length)); 
			}
			console.log(searchText)
			var searchword = $("#search_1").val(searchText);
		} else {
			var searchword = $('#search_1').val()
		};
		
		$(".publicSearch_container .header_middle ul li").click(function(){
			var searchText= jQuery.trim($("#search_1").val()); 
			var searchUrl_p =encodeURI("public.html?searchText="+searchText);
			var searchUrl_c =encodeURI("company.html?searchText="+searchText);
			var searchUrl_pr =encodeURI("product.html?searchText="+searchText);
			$(this).addClass("header-selected");
			$(this).siblings().removeClass("header-selected");
			var index=$(this).index();
			if(index==0){
				window.location.href =searchUrl_p
			}
			if(index==1){
				window.location.href =searchUrl_c
			}
			if(index==2){
				window.location.href =searchUrl_pr
			}
		});	
});